package com.example.android.worldracers;

public class Racer {
	
    private double mPosition = 10;
    private double mSpeed = 0;
    public double acceleration = 0.1;//0.05;
    public double deceleration = 0.3;
    public double breaking = 0.6;
    public double turningAmount = 5.0;
    private double mPosx = 0;
    
    public static final double PLAYER_MAX_SPEED = 15;
    public static final double PLAYER_MAX_SPEED_MPH = 200;
    public static final double PLAYER_MAX_SPEED_ON_GRASS = PLAYER_MAX_SPEED * 0.2;//40mph
    
    public static final double RIVAL_MAX_SPEED = 13;    
    public static final double RIVAL_MAX_CORNER_SPEED = 10;

    public double rivalStartPosx = -0.1;
    
	public static int TURN_LEFT = -1;
	public static int TURN_NONE = 0;
	public static int TURN_RIGHT = 1;
	public static int ACCELERATE = -1;
	public static int STOPPED = 0;
	public static int DECCELERATE = 1;
	private int mTurning = TURN_NONE;
	private int mAccelerating = STOPPED;
    
    public Racer() {    	
    }
    
    public void reset() {
        mPosition = 10;
        mSpeed = 0;
        mPosx = 0;
        mTurning = TURN_NONE;
        mAccelerating = STOPPED;
        //TODO reset posx to -50 or +50 if player or rival
    }
    
    public void stop() {
		mAccelerating = STOPPED;
		mTurning = TURN_NONE;
		mSpeed = 0;
    }
    
    public void increasePosition(double amount) {
    	mPosition += amount;
    }
    
    public double getPosition() {
    	return mPosition;    	
    }
    
    public void setTurning(int turning) {
    	mTurning = turning;
    }
    
    public int getTurning() {
    	return mTurning;
    }
    
    public void setAccelerating(int accelerating) {
    	mAccelerating = accelerating;
    }
    
    public int getAccelerating() {
    	return mAccelerating;
    }
    
    public double getSpeed() {
    	return mSpeed;
    }
    
    public void setSpeed(double speed) {
    	mSpeed = speed;    	
    }
    
    public void increaseSpeed(double amount) {
    	mSpeed += amount;
    }
    
    public void reduceSpeed(double amount) {
    	mSpeed -= amount;
    }
    
    public void increasePosX(double amount) {
    	mPosx += amount;
    }
    
    public void reducePosX(double amount) {
    	mPosx -= amount;    	
    }
    
    public double getPosX() {
    	return mPosx;
    }
    
}
